package com.dnjn.happiness.survey.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.happiness.common.core.annotation.Excel;
import com.dnjn.happiness.common.core.web.domain.BaseEntity;
import com.dnjn.happiness.system.api.domain.SysDept;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 参加问卷的人记录对象 svy_survey_record
 *
 * @author happiness
 * @date 2023-10-23
 */
@Schema(name = "SurveyRecord", description = "参加问卷的人记录")
@Accessors(chain = true)
@Getter
@Setter
@TableName("svy_survey_record")
public class SurveyRecord extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * PK
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "survey_record_id", type = IdType.ASSIGN_ID)
    private Long surveyRecordId;


    


    /**
     * 问卷id
     */
    @Schema(description = "问卷id")
    @Excel(name = "问卷id")
    private Long surveyId;

    /**
     * 参加问卷人的id
     */
    @Schema(description = "参加问卷人的id")
    @Excel(name = "参加问卷人的id")
    private Long userId;

    /**
     * 已参加 未参加
     */
    @Schema(description = "Y-已参加 N-未参加")
    @Excel(name = "已参加 未参加")
    private String recordStatus;

    /**
     * $column.columnComment
     */
    @Schema(description = "${comment}")
    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
    private Long etypeId;

    /**
     * 评价时间
     */
    @Schema(description = "评价时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "评价时间", width = 30, dateFormat = "yyyy-MM-dd")
    private Date dateAppraise;

    /**
     * 评价人
     */
    @Schema(description = "评价人")
    @Excel(name = "评价人")
    private String appraiser;

    /**
     * 答题评价
     */
    @Schema(description = "答题评价")
    @Excel(name = "答题评价")
    private String answerAppraise;

    /**
     * 评价星级
     */
    @Schema(description = "评价星级")
    @Excel(name = "评价星级")
    private Integer likeCounts;

    /**
     * 评价等级
     */
    @Schema(description = "评价等级")
    @Excel(name = "评价等级")
    @NotBlank(message = "评价等级不能为空")
    private String appraiseGrade;


    /**
     * 是否删除|0-否 1-是|valid
     */
    @Schema(description = "是否删除|0-否 1-是|valid")
    @Excel(name = "是否删除|0-否 1-是|valid")
    private String deleted;

    @TableField(exist = false)
    private String username;

    /**
     * 问卷得分  survey_score
     */
    @Schema(description = "问卷得分")
    private Integer surveyScore;

    @TableField(exist = false)
    private String nickName;

    @TableField(exist = false)
    private String avatar;

    @TableField(exist = false)
    private String surveyTitle;

    @TableField(exist = false)
    private Integer minScore;

    @TableField(exist = false)
    private Integer maxScore;

    /**
     * 区间等级
     */
    @Schema(description = "区间等级")
    @Excel(name = "区间等级")
    private Integer grade;

    @TableField(exist = false)
    private Long deptId;

    @TableField(exist = false)
    private String role;

    @TableField(exist = false)
    private SysDept sysDept;

    @TableField(exist = false)
    @Excel(name = "组织架构")
    private String parentNameAndDeptName;

    @Schema(name = "答题结果类型 人格|性格答题结果")
    private String answerType;

//    @TableField(exist = false)
//    @Excel
//    private String deptName;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("surveyRecordId", getSurveyRecordId())
                .append("surveyId", getSurveyId())
                .append("userId", getUserId())
                .append("recordStatus", getRecordStatus())
                .append("etypeId", getEtypeId())
                .append("dateAppraise", getDateAppraise())
                .append("appraiser", getAppraiser())
                .append("answerAppraise", getAnswerAppraise())
                .append("remark", getRemark())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("deleted", getDeleted())
                .append("version", getVersion())
                .append("surveyScore", getSurveyScore())
                .toString();
    }
}
